# coding: utf-8


class IMSyncProxy(object):
    """
    add by zhouhl 2017-09-12
    使用异步方式，同步客户的im信息
    因为不能在models里直接使用 current_app 变量，故封装一层代理
    """

    def init_app(self, app=None):
        self.app = app
        try:
            self.im_produce = app.im_produce
        except:
            self.im_produce = None

    def send(self, body):
        if self.im_produce:
            self.im_produce.send(body)
